﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.ContextMenu
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using UnityEngine.Scripting;

#nullable disable
namespace UnityEngine
{
  /// <summary>
  ///   <para>Use the ContextMenu attribute to add commands to the context menu of the Inspector window.</para>
  /// </summary>
  [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
  public sealed class ContextMenu : Attribute
  {
    public readonly string menuItem;
    public readonly bool validate;
    public readonly int priority;

    /// <summary>
    ///   <para>Adds the function to the context menu of the component.</para>
    /// </summary>
    /// <param name="itemName">The name of the context menu item.</param>
    /// <param name="isValidateFunction">Whether this is a validate function (defaults to false).</param>
    /// <param name="priority">Priority used to override the ordering of the menu items (defaults to 1000000). The lower the number the earlier in the menu it will appear.</param>
    public ContextMenu(string itemName)
      : this(itemName, false)
    {
    }

    /// <summary>
    ///   <para>Adds the function to the context menu of the component.</para>
    /// </summary>
    /// <param name="itemName">The name of the context menu item.</param>
    /// <param name="isValidateFunction">Whether this is a validate function (defaults to false).</param>
    /// <param name="priority">Priority used to override the ordering of the menu items (defaults to 1000000). The lower the number the earlier in the menu it will appear.</param>
    public ContextMenu(string itemName, bool isValidateFunction)
      : this(itemName, isValidateFunction, 1000000)
    {
    }

    /// <summary>
    ///   <para>Adds the function to the context menu of the component.</para>
    /// </summary>
    /// <param name="itemName">The name of the context menu item.</param>
    /// <param name="isValidateFunction">Whether this is a validate function (defaults to false).</param>
    /// <param name="priority">Priority used to override the ordering of the menu items (defaults to 1000000). The lower the number the earlier in the menu it will appear.</param>
    public ContextMenu(string itemName, bool isValidateFunction, int priority)
    {
      this.menuItem = itemName;
      this.validate = isValidateFunction;
      this.priority = priority;
    }
  }
}
